<template>
  <view class="router-view bcl-active pt-15 container">
    <!-- <view v-if="alipayAuthInfo.alipayAuth === 0">
			<view class="user-form bcl-white mb-15">
				<view class="box box-between box-column-center pl-15 pr-15 border border-bottom">
					<view class="bold">支付宝姓名</view>
					<view class="uni-input">
						<input type="text" placeholder="输入支付宝姓名" v-model="alipayForm.alipayName" />
					</view>
				</view>
			
				<view class="box box-between box-column-center pl-15 pr-15 border border-bottom">
					<view class="bold">支付宝账户</view>
					<view class="uni-input">
						<input type="text" placeholder="输入您的支付宝账户" v-model="alipayForm.alipayAccount" />
					</view>
				</view>
				
				<view class="box box-between box-column-center pl-15 pr-15 border border-bottom">
					<view class="bold">确认支付宝账户</view>
					<view class="uni-input">
						<input type="text" placeholder="确认您的支付宝账户" v-model="alipayForm.confirmAlipayAccount" />
					</view>
				</view>
				
			</view>
			
			<view class="container">
				<button class="uni-button uni-button-lg uni-button-full mt-50" @tap="bind">立即绑定</button>
			</view>
		</view> -->

    <!-- 等待打款 -->
    <view v-if="status == 1">
      <view class="text-center">
        <text class="icon icon-info fz-40 cl-warning circle mr-10"></text>
      </view>
      <view class="text-center fz-18 bold mt-15"
        >我们已经向您提供的账号进行打款，请填入收到的金额输入进行验证</view
      >

      <view class="mt-40 text-center">
        <view class="fz-20 bold">请输入打款金额</view>
        <view class="uni-input bcl-white m-15">
          <input type="number" placeholder="打款金额" v-model="money" />
        </view>
      </view>

      <view class="container mt-50">
        <button class="uni-button uni-button-lg uni-button-full" @tap="bind">
          立即认证
        </button>
      </view>
    </view>

    <!-- 等待打款 -->
    <view v-else>
      <view class="text-center">
        <text class="icon icon-info fz-40 cl-warning circle mr-10"></text>
      </view>
      <view class="text-center fz-18 bold mt-15"
        >正在审核中！我们会尽快为您的账户安排打款</view
      >
    </view>
  </view>
</template>

<script>
import { bindAlipay } from "@/apis/user";

export default {
  data() {
    return {
      status: null, // 认证步骤 初始值null = 审核中，等待打款； 1 已打款
      money: "",
      id: null,
    };
  },

  onLoad(options) {
    // this.checkAuthStatus();
    this.status = options.status;
    this.id = options.id;
  },

  methods: {
    /**
     * 绑定
     */
    async bind() {
      if (!this.money) return this.$toast("请输入打款金额");

      let params = {
        user_get_cash: this.money,
        id: this.id,
      };
      let { code, data, message } = await bindAlipay();
      if (code === 200) {
        this.$toast("认证成功", "success");
        setTimeout(() => {
          uni.navigateBack();
        }, 500);
      }
    },

    /**
     * 支付状态
     */
    // async checkAuthStatus() {
    // 	let { code, data } = await alipayAuthStatus();
    // 	if (code === 200) {
    // 		// alipayAuth > 0 为已提交审核
    // 		if (data.alipayAuth > 0) this.step = data.status;
    // 		this.alipayAuthInfo = data;
    // 	}
    // }
  },
};
</script>

<style lang="scss" scoped>
.router-view {
  .uni-input {
    margin-bottom: 0;
    border: none;
  }
}
</style>
